<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>

<head>
<meta http-equiv="content-language" content="de" />
<meta http-equiv="content-type" content="text/html; charset=utf-8;" />
<title>railbrowser</title>
<link rel="stylesheet" type="text/css" href="css/railbrowser.css" media="all" />
<script src="includes/popupmenu.js" type="text/javascript"></script>
<script src="includes/popup.js" type="text/javascript"></script>
<script type="text/javascript">
	/* add a new attrbute to current object
	 */
	function add_attribute () {
		popup_init('Attribute hinzufügen', 'addattribute.php', 360, 120);
	}

	/* add new object to current objects inventory.
	 */
	function add_object () {
		popup_init('Objekt hinzufügen', 'addobject.php', 360, 120);
	}

	/* remove one attribute from current object
	 * @param string attribute
	 */
	function delete_attribute ( attribute ) {
		ques = window.confirm("Das Attribute '" + attribute + "' wird gelöscht.")

		if( ques )
			location.href = "index.php?delete_attribute=" + attribute;
	}

	/* delete an rail_object.
	 * @param rail_object id
	 * @param string name
	 */
	function delete_object ( id, name ) {
		overpopupmenu = false;
		popupmeu_close();

		ques = window.confirm("Das Objekt '" + name + "' wird gelöscht.");

		if( ques )
			location.href = "index.php?delete_object=" + id;
	}

	/* open the properties popop.
	 * @param rail_object id
	 */
	function open_properties ( id ) {
		overpopupmenu = false;
		popupmeu_close();

		if( parent.modul_railbrowser_init_popup )
			parent.modul_railbrowser_init_popup( 'Eigenschaften', 'modules/railbrowser/properties.php?object=' + id, 280, 480, 10, 10 );
		else{
			f1 = window.open( "properties.php", "Eigenschaften", "width=280,height=480,left=10,top=10,scrollbars=yes");
	  		f1.focus();
		}
	}

	/* remove content from rail_document.
	 */
	function remove_documents_content () {
		ques = window.confirm("Der Inhalt des aktuellen Objektes wird gelöscht.")

		if( ques )
			location.href = "index.php?remove_documents_content=";
	}
</script>
</head>

<body>

<div id="menubar">
<form>
<label>Pfad<input type="text" name="path" value="<!--{$object.path}-->" /></label>
<label>Objekt<input type="text" name="object" value="<!--{$object.id}-->" /></label>
<button type="submit">los</button>
</form>
</div>

<!-- Beginn: Browser -->
<div id="browser">
<!--{if $object.content}-->
<div id="content">
<!--{$object.content}-->
</div>
<!--{/if}-->
<div id="inventory">
<!--{if $object.environment gt 0}-->
<div id="inventory__environment" style="background-image: url(css/img/up.png); cursor: pointer;" onclick="javascript:location.href='index.php?object=<!--{$object.environment}-->';">
<p>..</p>
</div>
<!--{/if}-->
<!--{foreach from=$inventory item=inv}-->
<ul id="popupmenu__<!--{$inv.id}-->" class="popupmenu" style="position:absolute; display:none; z-index:10000;" onmouseover="javascript:overpopupmenu=true;" onmouseout="javascript:overpopupmenu=false;">
<li><a href="index.php?object=<!--{$inv.id}-->"><span></span>Öffnen</a></li>
<hr />
<li><a <!--{if $inv.is_writeable}-->href="index.php?cut_object=<!--{$inv.id}-->" class="cut"<!--{else}-->class="cut_disabled"<!--{/if}-->><span></span>Ausschneiden</a></li>
<li><a <!--{if $inv.is_writeable}-->href="index.php?copy_object=<!--{$inv.id}-->" class="copy"<!--{else}-->class="copy_disabled"<!--{/if}-->><span></span>Kopieren</a></li>
<li><a <!--{if $inv.is_writeable}-->href="index.php?link_object=<!--{$inv.id}-->"<!--{else}-->class="disabled"<!--{/if}-->><span></span>Verlinken</a></li>
<hr />
<li><a href="javascript:open_properties(<!--{$inv.id}-->);"><span></span>Eigenschaften</a></li>
<li><a <!--{if $inv.is_writeable}-->href="javascript:delete_object(<!--{$inv.id}-->, '<!--{$inv.name}-->');" class="delete"<!--{else}-->class="delete_disabled"<!--{/if}-->><span></span>löschen</a></li>
</ul>
<div id="inventory__<!--{$inv.id}-->" style="background-image: url(<!--{$inv.icon}-->);" ondblclick="javascript:isDoubleClick=true;location.href='index.php?object=<!--{$inv.id}-->';">
<p><!--{$inv.name}--></p>
<p><!--{$inv.type}--></p>
</div>
<!--{/foreach}-->
</div>
</div>
<!-- End: Browser -->

<!-- Beginn: h1 -->
<ul id="popupmenu__current_object" class="popupmenu" style="position:absolute; display:none; z-index:10000;" onmouseover="javascript:overpopupmenu=true;" onmouseout="javascript:overpopupmenu=false;">
<li><a <!--{if $object.is_writeable AND $object.type neq "rail_root"}-->href="index.php?cut_object=<!--{$object.id}-->" class="cut"<!--{else}-->class="cut_disabled"<!--{/if}-->><span></span>Ausschneiden</a></li>
<li><a <!--{if $object.is_writeable}-->href="index.php?copy_object=<!--{$object.id}-->" class="copy"<!--{else}-->class="copy_disabled"<!--{/if}-->><span></span>Kopieren</a></li>
<li><a <!--{if $object.is_writeable}-->href="index.php?link_object=<!--{$object.id}-->"<!--{else}-->class="disabled"<!--{/if}-->><span></span>Verlinken</a></li>
<hr />
<li><a href="javascript:open_properties(<!--{$object.id}-->);"><span></span>Eigenschaften</a></li>
<li><a <!--{if $object.is_writeable AND $object.type neq "rail_root"}-->href="javascript:delete_object(<!--{$object.id}-->, '<!--{$object.name}-->');" class="delete"<!--{else}-->class="delete_disabled"<!--{/if}-->><span></span>löschen</a></li>
</ul>
<h1>
<img id="current_object" src="<!--{$object.icon}-->" border="0" title="Dieses Objekt." />
<p>Name: <b title="<!--{$object.name}-->"><!--{$object.name}--></b><br />
Type: <!--{$object.type}--></p>
</h1>
<!-- End: h1 -->

<!-- Beginn: object navigation -->
<ul id="object_navigation">
<li><a <!--{if $object.is_writeable}-->href="javascript:add_attribute();"<!--{else}-->class="disabled"<!--{/if}--> id="obj_addattribute">Attribute hinzufügen</a></li>
<li><a <!--{if $object.is_writeable}-->href="javascript:add_object();"<!--{else}-->class="disabled"<!--{/if}--> id="obj_addobject">Objekt hinzufügen</a></li>
<li><a <!--{if $object.is_writeable AND $clipboard.object}-->href="index.php?insert_object"<!--{else}-->class="disabled"<!--{/if}--> id="obj_paste"><!--{if $clipboard.aslink}-->Link<!--{else}-->Objekt<!--{/if}--> einfügen</a></li>
</ul>
<!-- End: object navigation -->

<!-- Beginn: attributes -->
<!--{if $object.is_readable}-->
<form id="attribute_form" action="index.php" method="POST">
<h2>Alle Attribute (<!--{$attributes_size}-->):</h2>
<div>
<!--{foreach from=$attributes item=attribute}-->
<label for="att" <!--{if $attribute.readonly}-->class="readonly"<!--{/if}--> title="<!--{$attribute.name}-->"><!--{$attribute.name}--><!--{if $attribute.removeable}--><a href="javascript:delete_attribute('<!--{$attribute.name}-->');" title="Attribute löschen."><img src="css/img/delete.png" border="0" /></a><!--{/if}--></label>
<input type="text" id="att" name="attributes[<!--{$attribute.name}-->]" value="<!--{$attribute.value}-->" <!--{if $attribute.readonly}-->readonly="readonly"<!--{/if}--> />
<!--{/foreach}-->
</div>
<button type="submit" <!--{if !$object.is_writeable}-->disabled="disabled"<!--{/if}-->>Attribute speichern</button>
</form>
<!--{/if}-->
<!-- End: attributes -->

<script type="text/javascript">
// popup menu(s) for inventory
var childs = document.getElementById("inventory").childNodes;
for(var i = 0; i < childs.length; i++){
	id = "" + childs[i].id;
	if( id.substring(0, 11) == "inventory__" );
		childs[i].onmousedown = popupmeu_open;
}
// popup menu for current object
document.getElementById("current_object").onmousedown = popupmeu_open;

document.onmousedown = popupmeu_close;
</script>
</body>

</head>